Skip to content

Instantly share code, notes, and snippets.

View nihal111's full-sized avatar

Nihal Singh nihal111

View GitHub Profile
@nihal111
nihal111 / byzanz-record-window.sh
Created February 6, 2017 11:57
A script to ease usage of byzanz, a tool for recording GIFs in Linux.
#!/bin/bash
# AUTHOR: (c) Rob W 2012, modified by MHC (http://askubuntu.com/users/81372/mhc)
# NAME: GIFRecord 0.1
# DESCRIPTION: A script to record GIF screencasts.
# LICENSE: GNU GPL v3 (http://www.gnu.org/licenses/gpl.html)
# DEPENDENCIES: byzanz,gdialog,notify-send (install via sudo add-apt-repository ppa:fossfreedom/byzanz; sudo apt-get update && sudo apt-get install byzanz gdialog notify-osd)
# Time and date
TIME=$(date +"%Y-%m-%d_%H%M%S")
{
"location" : {},
"particleDataSprite": {
"texture": "AdventureAssets:blueParticle"
},
"positionRangeGenerator": {
"minPosition": [-0.5, 0, -0.5],
"maxPosition": [0.5, 0, 0.5]
},
"energyRangeGenerator": {
@nihal111
nihal111 / update_time.py
Last active October 29, 2021 07:05
A python script to update time in Windows using HTTPS, when NTP is not working. Works on scraping duration since epoch time from www.unixtimestamp.com and uses win32api (earlier pywin32) to update the system time. Needs to be run with administrator permissions.
import requests
import datetime
import win32api
page = requests.get('https://www.unixtimestamp.com/', headers={'Cache-Control': 'no-cache'})
text = page.text
for line in text.split("\n"):
match_text = "<h3 class=\"text-danger\">"
@nihal111
nihal111 / ntp_update_time.py
Last active May 4, 2024 19:00
A python script to update system time in Windows by attempting to fetch time from multiple NTP servers from a defined list.
import socket
import struct
import sys
import time
import datetime
import win32api
# List of servers in order of attempt of fetching
server_list = ['ntp.iitb.ac.in', 'time.nist.gov', 'time.windows.com', 'pool.ntp.org']
@nihal111
nihal111 / wpa_supplicant.conf
Last active November 3, 2018 11:53
Connect to IITB-Wireless through RPi. This config can be used to connect to any WPA2 Enterprise network in general. Just change the ssid, identity and password fields.
network={
ssid="IITB-Wireless"
scan_ssid=1
key_mgmt=WPA-EAP
identity="<your_username>"
password="<your_password>"
eap=PEAP
phase1="peaplabel=0"
phase2="auth=MSCHAPV2"
}
@nihal111
nihal111 / translate.py
Created June 5, 2018 15:32
Translates a bulky file with pre and post processing. Takes care of rate limit of Google Translate API.
#!/usr/bin/python
# -*- coding: utf-8 -*-
from googletrans import Translator
import time
BATCH_SIZE = 300
WAIT = 105
INPUT_FILE = 'strings.xml'