Skip to content

Instantly share code, notes, and snippets.

View empeje's full-sized avatar
:octocat:
Focusing

Abdurrachman M empeje

:octocat:
Focusing
View GitHub Profile
@empeje
empeje / exercise1.jsx
Last active December 17, 2017 11:11
[SNIPPET-13] Samer Buna - ReactJs Getting Started
class Button extends React.Component {
// constructor (props) {
// super(props);
// this.state = { counter: 0 };
// }
state = { counter: 0 }
handleClick = () => {
// this.state.counter++
this.setState((prevState) => ({
@empeje
empeje / spiral_matrix.py
Last active December 17, 2017 11:11
[SNIPPET-12] Spiral Matrix in Python
def create_matrix(width, height):
result = []
for i in range(height):
result.append([0 for i in range(width)])
print (result)
# TOP BOTTOM LEFT RIGHT
T = 0
B = height - 1
@empeje
empeje / rspec_gist
Last active December 17, 2017 11:19
[SNIPPET-11] Rspec command
bundle exec rspec -fd {{directory}}
@empeje
empeje / docker_commands.sh
Last active June 4, 2019 12:59
Mac OSX Docker Cleanup
#!/usr/bin/env bash
ls -lah ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2
rm -rf ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2
docker-compose ps
docker rmi -f $(docker images -aq)
sudo docker ps -a | grep Exit | cut -d ' ' -f 1 | xargs sudo docker rm
@empeje
empeje / WihoutLoop.java
Last active December 17, 2017 11:10
[SNIPPET-09] Printing Number Without Loops Java
public class WihoutLoop{
public static void main(String []args){
reachfinal(0,100);
}
public static void reachfinal(int startpoint, int finalpoint){
if (startpoint != finalpoint){
System.out.println(startpoint);
reachfinal(startpoint+1, finalpoint);
@empeje
empeje / tmux.conf
Last active June 4, 2019 13:00
My Preferred tmux configuration
set-window-option -g mode-keys vi
set -g status-keys vi
# Easy config reload
bind-key r source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
@empeje
empeje / app.conf
Last active June 4, 2019 13:03
Nginx Security Header Template
server_tokens off;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name le3.empeje.org;
location /.well-known/acme-challenge/ {
root /var/www/letsencrypt;
@empeje
empeje / README.md
Last active December 17, 2017 11:09
[SNIPPET-06] My Windows Configuration

Tools

Git for Windows

It can be downloaded here

Amix Vimrc

It can be downloaded here

@empeje
empeje / install_docker.sh
Last active June 4, 2019 13:03
Install Docker on Digital Ocean VM
#!/usr/bin/env bash
apt update
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
apt install docker-ce
apt install python
@empeje
empeje / install_datadog.sh
Last active June 4, 2019 13:04
Install DataDog Agent as per December 2017
#!/usr/bin/env bash
sudo sh -c "echo 'deb http://apt.datadoghq.com/ unstable main' > /etc/apt/sources.list.d/datadog.list"
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C7A7DA52
sudo apt-get install datadog-agent
sudo sh -c "sed 's/api_key:.*/api_key: your_api_key' /etc/dd-agent/datadog.conf.example > /etc/dd-agent/datadog.conf"
/etc/init.d/datadog-agent start