Skip to content

Instantly share code, notes, and snippets.

View Ara4Sh's full-sized avatar

Arash Shams Ara4Sh

View GitHub Profile
@numb95
numb95 / route-all-traffic-through-tor.md
Last active February 28, 2024 03:05
Route all internet traffic through Tor

Do not use in production Server or if you don't know what iptables do

Add this to torrc ( located on /etc/tor/torrc):

VirtualAddrNetwork 10.192.0.0/10

AutomapHostsOnResolve 1

TransPort 9051 
@victoraguilarc
victoraguilarc / prestashop-nginx.conf
Last active March 24, 2020 10:31
NGINX Configuration for Prestashop 1.7.3, its works fully
server {
charset utf-8;
#listen <YOUR_IP>:80;
server_name <YOUR_DOMAIN> www.<YOUR_DOMAIN>;
root /PATH/TO/YOUR/PRESTASHOP/INSTALLATION;
index index.php;
access_log /var/log/nginx/domains/<YOUT_DOMAIN>.log combined;
@johanburati
johanburati / gpu.lua
Created March 28, 2018 09:04
gpu.lua
-- Max Jaderberg 4/9/13
-- GPU Effectiveness test
require 'torch'
require 'sys'
require 'nn'
require 'xlua'
cmd = torch.CmdLine()
cmd:text()
@edsiper
edsiper / kubernetes_commands.md
Last active May 6, 2024 08:53
Kubernetes Useful Commands
@whiteinge
whiteinge / complex_salt_orchestrate.sls
Last active March 20, 2024 15:48
An example of a complex, multi-host Salt Orchestrate state that performs status checks as it goes
# /srv/salt/upgrade_the_app.sls
# Example of a complex, multi-host Orchestration state that performs status checks as it goes.
# Note, this is untested and is meant to serve as an example.
# Run via: salt-run state.orch upgrade_the_app pillar='{nodes: [nodeA, nodeB], version: 123}'
{% set nodes = salt.pillar.get('nodes', []) %}
{% set all_grains = salt.saltutil.runner('cache.grains',
tgt=','.join(nodes), tgt_type='list') %}
{# Default version if not given at the CLI. #}
@reagent
reagent / 00_README.md
Last active January 29, 2024 13:31
Custom HTTP Routing in Go

Custom HTTP Routing in Go

Basic Routing

Responding to requests via simple route matching is built in to Go's net/http standard library package. Just register the path prefixes and callbacks you want invoked and then call the ListenAndServe to have the default request handler invoked on each request. For example:

package main

import (
@bbinet
bbinet / pepper_format.py
Last active March 15, 2021 14:13
Use salt outputters to format pepper output, see https://github.com/saltstack/pepper/issues/3
#!/home/bruno/.virtualenvs/salt/bin/python
"""
This script formats pepper output using salt outputters.
It can both format sync and async jobs, and can be used in the following ways:
```
$ pepper \* state.sls core | pepper_format.py -o highstate
$ pepper --client=local_async \* state.highstate | pepper_format.py
$ pepper_format.py 20170504160400750792
```
@aliok
aliok / jenkinsfile-commons.groovy
Created April 26, 2017 12:35
Sample advanced Jenkins pipeline
/**
* This file provides common stuff to be used in the pipelines.
* It is important to load it after repo checkout is done: see https://github.com/jenkinsci/pipeline-plugin/blob/master/TUTORIAL.md#triggering-manual-loading
*
*/
/**
* Dumps some info about the environment.
* @return
*/
@BretFisher
BretFisher / docker-for-mac.md
Last active May 6, 2024 07:28
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@amirasaran
amirasaran / BaseThreading
Created October 27, 2016 06:36
Python threading with callback function (callback function run after thread is finished)
import time
import threading
class BaseThread(threading.Thread):
def __init__(self, callback=None, callback_args=None, *args, **kwargs):
target = kwargs.pop('target')
super(BaseThread, self).__init__(target=self.target_with_callback, *args, **kwargs)
self.callback = callback
self.method = target