Skip to content

Instantly share code, notes, and snippets.

View geoyws's full-sized avatar

George Yong geoyws

View GitHub Profile
@geoyws
geoyws / replace.sh
Created August 9, 2022 02:33 — forked from hlissner/replace.sh
Bulk search & replace with ag (the_silver_searcher)
# ag <https://github.com/ggreer/the_silver_searcher>
# usage: ag-replace.sh [search] [replace]
# caveats: will choke if either arguments contain a forward slash
# notes: will back up changed files to *.bak files
ag -0 -l $1 | xargs -0 perl -pi.bak -e "s/$1/$2/g"
# or if you prefer sed's regex syntax:
ag -0 -l $1 | xargs -0 sed -ri.bak -e "s/$1/$2/g"
@geoyws
geoyws / ruby-2-3-install.sh
Created August 4, 2022 17:09 — forked from mdesantis/ruby-2-3-install.sh
Install Ruby 2.3 on Ubuntu 19.10 using asdf (ruby-build)
#!/bin/bash
# It assumes [asdf](https://github.com/asdf-vm/asdf) to be installed
# and asdf plugin for Ruby to be added
set -exuo pipefail
sudo apt install libreadline-dev
wget https://www.openssl.org/source/old/1.0.2/openssl-1.0.2u.tar.gz
tar -xzf openssl-1.0.2u.tar.gz
#!/bin/sh
#
# Adam Sharp
# Aug 21, 2013
#
# Usage: Add it to your PATH and `git remove-submodule path/to/submodule`.
#
# Does the inverse of `git submodule add`:
# 1) `deinit` the submodule
# 2) Remove the submodule from the index and working directory
@geoyws
geoyws / react.html
Created October 6, 2016 04:32 — forked from RickWong/react.html
Write React apps in 1 HTML file.
<html>
<body>
<div id="react-root"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-with-addons.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.5.2/redux.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.7.7/babel.min.js"></script>
<script id="react-app" type="text/template">
const App = ({name}) => {
@geoyws
geoyws / step0.js
Last active June 5, 2018 08:22 — forked from shimondoodkin/goals.md
plain vanilla node.js intro tutorial to learn a lot in the shortest time.
//go to nodejs.org and copy the simple hello world code to a file.
// test it go with the browser to http://127.0.0.1:1337/
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, '127.0.0.1'); // remove the ip argument from listen. otherwise it will bind only to this ip address. and you wont be able to connect if it runs on a server.
console.log('Server running at http://127.0.0.1:1337/');