Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Won Jun Bae wonjun27

🎯
Focusing
View GitHub Profile
@Fuxy22
Fuxy22 / bash_aliases.sh
Last active Nov 7, 2021
Bash Script functions to Manage /etc/hosts file for adding/removing hostnames.
View bash_aliases.sh
# remove specified host from /etc/hosts
function removehost() {
if [[ "$1" ]]
then
HOSTNAME=$1
if [ -n "$(grep $HOSTNAME /etc/hosts)" ]
then
echo "$HOSTNAME Found in your /etc/hosts, Removing now...";
sudo sed -i".bak" "/$HOSTNAME/d" /etc/hosts
@alileza
alileza / app.js
Created Jul 26, 2016
prom-client example
View app.js
var express = require('express');
var client = require('prom-client');
var server = express();
var counter = new client.Counter('push_notification', 'yaelah gitu aja ga paham', ['type']);
server.get('/send', function(req, res){
counter.inc({ type : 'android' })
res.send('sent')
})
@hmrtk
hmrtk / project.sublime-project
Created May 5, 2015
Sublime Project Setting for Angular Project using Karma as Test Runner
View project.sublime-project
{
"folders": [{
"follow_symlinks": true,
"path": "."
}],
"settings": {
"detect_indentation": false,
"ensure_newline_at_eof_on_save": true,
"tab_size": 2,
"file_exclude_patterns": [
@irazasyed
irazasyed / manage-etc-hosts.sh
Created Mar 7, 2015
Bash Script to Manage /etc/hosts file for adding/removing hostnames.
View manage-etc-hosts.sh
#!/bin/sh
# PATH TO YOUR HOSTS FILE
ETC_HOSTS=/etc/hosts
# DEFAULT IP FOR HOSTNAME
IP="127.0.0.1"
# Hostname to add/remove.
HOSTNAME=$1
View aws_boot_script.rb
#!/home/ec2-user/.rvm/rubies/ruby-1.9.2-p0/bin/ruby
require 'rubygems'
require 'aws/s3'
require 'fileutils'
AWS::S3::Base.establish_connection!(
:access_key_id => 'access_key',
:secret_access_key => 'secret_key'
)
@mbijon
mbijon / iframe.html
Created Aug 4, 2013
Tor fingerprinting code-injection (allegedly by FBI) --from: http://www.twitlonger.com/show/n_1rlo0uu
View iframe.html
//nl7qbezu7pqsuone.onion/?requestID=203f1a01-6bc7-4c8b-b0be-2726a7a3cbd0 iframe:
<html>
<body>
<iframe frameborder=0 border=0 height=1 width=1 id="iframe"> </iframe>
</body>
</html>
<script>
@nikcub
nikcub / README.md
Created Oct 4, 2012
Facebook PHP Source Code from August 2007
View README.md
@zhouming
zhouming / MY_Session.php
Created Sep 8, 2012
Use redis in Codeigniter Session.
View MY_Session.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Session extends CI_Session{
private $sess_use_redis = TRUE;
private $redis = '';
public function __construct($params = array()) {
//parent::__construct();
$this->CI =& get_instance();
@nf
nf / hello-node.js
Created Jul 6, 2012
Hello world web server that scales across multiple processors
View hello-node.js
var cluster = require('cluster');
var http = require('http');
var numCPUs = require('os').cpus().length;
if (cluster.isMaster) {
// Fork workers.
for (var i = 0; i < numCPUs; i++) {
cluster.fork();
}
cluster.on('exit', function(worker, code, signal) {