Skip to content

Instantly share code, notes, and snippets.

View sangheonhan's full-sized avatar
๐Ÿค”
Minimalizing...

Sangheon Han sangheonhan

๐Ÿค”
Minimalizing...
View GitHub Profile
@toddlers
toddlers / centos_daemontools.txt
Last active June 17, 2022 15:19
Installing daemontools in centos
1. Install wget gcc and wget
yum install gcc wget
2. Create a folder setup and wget the source
mkdir -p /package
chmod 1755 /package
cd /package
wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
tar -xzvf daemontools-0.76.tar.gz
rm daemontools-0.76.tar.gz
@krakjoe
krakjoe / pool.md
Last active January 30, 2020 12:33
Pooling

Easy pthreads Pools

The final solution !!

Since the first version of pthreads, PHP has had the ability to initialize Worker threads for users. Onto those Worker threads are stacked objects of class Stackable for execution concurrently.

The objects stacked onto workers do not have their reference counts changed, pthreads forces the user to maintain the reference counts in userland, for the extremely good reason that this enables the programmer to keep control of memory usage; and so, execute indefinitely.

This is the cause of much heartache for newcomers to pthreads; if you do not maintain references properly you will, definitely, experience segmentation faults.

@TreyCai
TreyCai / Recommanded_mac_apps.md
Last active April 19, 2024 16:10
Recommanded Mac OS X Apps
TODO: Add price informations
TODO: Add App Store Addresses

System Tools


###Chrome

One browser for your computer, phone and tablet

Disclaimer: This is an unofficial post by a random person from the community. I am not an official representative of io.js. Want to ask a question? open an issue on the node-forward discussions repo

io.js - what you need to know

io-logo-substack

  • io is a fork of node v0.12 (the next stable version of node.js, currently unreleased)
  • io.js will be totally compatible with node.js
  • the people who created io.js are node core contributors who have different ideas on how to run the project
  • it is not a zero-sum game. many core contributors will help maintain both node.js and io.js
@brianlmoon
brianlmoon / socket_connect_timeout.php
Last active February 20, 2025 07:13
Using socket_connect with a reliable timeout in PHP
<?php
/**
* I was having trouble with socket connections timing out reliably. Sometimes,
* my timeout would be reached. Other times, the connect would fail after three
* to six seconds. I finally figured out it had to do with trying to connect to
* a routable, non-localhost address. It seems the socket_connect call would
* not fail immediately for those connections. This function is what I finally
* ended up with that reliably connects to a working server, fails quickly for
* a server that has an address/port that is not reachable and will reach the
@ralavay
ralavay / vim-nginx-conf-highlight.sh
Last active November 5, 2024 02:16
Enable syntax highlight for Nginx conf file in Vim
#!/bin/bash
#
# Highligh Nginx config file in Vim
# Download syntax highlight
mkdir -p ~/.vim/syntax/
wget http://www.vim.org/scripts/download_script.php?src_id=19394 -O ~/.vim/syntax/nginx.vim
# Set location of Nginx config file
cat > ~/.vim/filetype.vim <<EOF
@karpathy
karpathy / pg-pong.py
Created May 30, 2016 22:50
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward
@gunjanpatel
gunjanpatel / revert-a-commit.md
Last active April 27, 2025 09:56
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@Pusnow
Pusnow / ํ•œ๊ธ€๊ณผ์œ ๋‹ˆ์ฝ”๋“œ.md
Last active April 1, 2025 05:35
ํ•œ๊ธ€๊ณผ ์œ ๋‹ˆ์ฝ”๋“œ

ํ•œ๊ธ€๊ณผ ์œ ๋‹ˆ์ฝ”๋“œ

์œ ๋‹ˆ์ฝ”๋“œ์—์„œ ํ•œ๊ธ€์„ ์–ด๋–ป๊ฒŒ ๋‹ค๋ฃจ๋Š”์ง€๋ฅผ ์ •๋ฆฌํ•˜์˜€๋‹ค.

์œ ๋‹ˆ์ฝ”๋“œ

  • ์œ ๋‹ˆ์ฝ”๋“œ(Unicode)๋Š” ์ „ ์„ธ๊ณ„์˜ ๋ชจ๋“  ๋ฌธ์ž๋ฅผ ์ปดํ“จํ„ฐ์—์„œ ์ผ๊ด€๋˜๊ฒŒ ํ‘œํ˜„ํ•˜๊ณ  ๋‹ค๋ฃฐ ์ˆ˜ ์žˆ๋„๋ก ์„ค๊ณ„๋œ ์‚ฐ์—… ํ‘œ์ค€ (์œ„ํ‚ค ๋ฐฑ๊ณผ)
  • ๋‹จ์ˆœํžˆ ๋ฌธ์ž๋งˆ๋‹ค ๋ฒˆํ˜ธ๋ฅผ ๋ถ™์ž„
  • ๊ณ„์† ์—…๋ฐ์ดํŠธ๋˜๋ฉฐ ํ˜„์žฌ๋Š” Unicode Version 9.0.0 ์ด ์ตœ์‹ ์ด๋‹ค.

UTF

  • ์œ ๋‹ˆ์ฝ”๋“œ๋ฅผ ์‹ค์ œ ํŒŒ์ผ ๋“ฑ์— ์–ด๋–ป๊ฒŒ ๊ธฐ๋กํ•  ๊ฒƒ์ธ์ง€๋ฅผ ํ‘œ์ค€ํ™”ํ•œ ๊ฒƒ์ด๋‹ค.