Skip to content

Instantly share code, notes, and snippets.

View udnaan's full-sized avatar
🌎
Thriving

Adnan Yunus udnaan

🌎
Thriving
View GitHub Profile
@udnaan
udnaan / gist:51017d2ce7e808894bdada1454815cf5
Created January 26, 2021 09:21
Remove metrics package from atom complete
1. sudo rm -rf /usr/share/atom/resources/app/apm/node_modules/npm/lib/utils/metrics*
2. sudo vi `/usr/share/atom/resources/app/apm/node_modules/npm/lib/npm.js`
3. Remove the line that requires 'metrics' package
@udnaan
udnaan / start_later_or_reset.py
Created November 22, 2020 12:15
gevent rate limiter pattern
import gevent
processes = {}
def process(id, data):
print(f'{id=} {data=}')
# reschedule the process function to run after a second.
# If reschedulre is called again before 1 second is up, the previous function is cancelled
@udnaan
udnaan / module.txt
Created September 8, 2020 20:12
Build kernel modules that are not included in official build - Debian
Get source: `apt install linux-source-*`
Extract source somewhere `tar xf /usr/src/linux-source-*`
cd to the module to build i.e `cd drivers/nvme/target/`
Build it using existing kernel
make -C /lib/modules/5.7.0-0.bpo.2-amd64/build M=(pwd)
Install to modules extra dir `sudo make -C /lib/modules/5.7.0-0.bpo.2-amd64/build M=(pwd) modules_install`
Generate dependencies `sudo depmod`
@udnaan
udnaan / BuildConfiguration.xml
Last active January 13, 2021 04:00
Unreal 4.22 compile
This is what worked for me on 4.22 on Linux (ubuntu 18.04)
Engine/Saved/UnrealBuildTool/BuildConfiguration.xml
<?xml version="1.0" encoding="utf-8" ?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
<LocalExecutor>
<MaxProcessorCount>8</MaxProcessorCount>
</LocalExecutor>
</Configuration>
@udnaan
udnaan / setup.py
Created October 20, 2018 01:33
Use distutils to create a static library (for external usage)
from distutils.ccompiler import new_compiler
from sysconfig import get_paths
import os
project_name = "slimey_project"
source = ['source1.c']
include_dirs = ['include']
build_dir = os.path.join(os.path.dirname(__file__), 'build')
class StaticLib(Command):
@udnaan
udnaan / decode.js
Created September 22, 2018 00:51
Decode devices from a rooted device for tuya smart life app
const fs = require('fs');
const path = require('path');
const xml2js = require('xml2js');
const data = fs.readFileSync(path.join(__dirname, process.argv[2]), {encoding: 'UTF-8'});
xml2js.parseString(data, (err, result) => {
const str = result.map.string[6]._;
console.log(str);
@udnaan
udnaan / gnome_change_workspace.py
Last active September 2, 2018 03:29
Changes workspace on a gnome desktop (i.e Ubuntu). Written to be able to switch workspace while running vnc/remote desktop in fullscreen
#!/usr/bin/env python3
# Documentation for Wnck is at http://lazka.github.io/pgi-docs/#Wnck-3.0/classes/Workspace.html#Wnck.Workspace.get_number
# Documentation for keyboard is at https://github.com/boppreh/keyboard
import keyboard as kb
import gi
gi.require_version('Wnck', '3.0')
from gi.repository import Wnck, Gtk
const functions = require('firebase-functions');
const admin = require('firebase-admin');
const {credentials} = functions.config().auth;
credentials.private_key = credentials.private_key.replace(/\\n/g, '\n');
const config = Object.assign({}, functions.config().firebase, {credentials});
admin.initializeApp(config);
const gcs = require('@google-cloud/storage')({credentials});
const dns = require('@google-cloud/dns')({credentials});
const zoneName = 'applambda';
const zone = dns.zone(zoneName);
@udnaan
udnaan / vimrc
Created November 12, 2016 02:04
.vimrc
set clipboard=unnamed
set shell=bash
syntax on
set nocompatible " be iMproved, required
filetype off " required
filetype plugin indent on
" show existing tab with 4 spaces width
set tabstop=4
" " when indenting with '>', use 4 spaces width
@udnaan
udnaan / .eslintrc.json
Created August 2, 2016 21:12
eslint config
{
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {