Skip to content

Instantly share code, notes, and snippets.

View Tafhim's full-sized avatar

Tafhim Ul Islam Tafhim

  • Earth
View GitHub Profile
@Tafhim
Tafhim / client.py
Created February 23, 2021 23:35 — forked from plq/client.py
Spyne Example
from suds.client import Client
url = 'http://localhost:7789/?wsdl'
company = '2CA'
store = 1
password = '1234'
client = Client(url)
client.service.GetTicketList( 'company_name', 1, '1234' )
@Tafhim
Tafhim / MultipleSelectionCombo.java
Created January 14, 2020 23:10 — forked from suxiaogang/MultipleSelectionCombo.java
SWT Multiple Selection Combo
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@Tafhim
Tafhim / replace_all.sh
Created March 18, 2019 13:29
Replace all occurrences of a string with another string. Including files and directory names. For files and directory names, might need to be run multiple times in order to make sure all occurrences are replaced. It replaces LAST occurrence in a file's name and directory at first.
#!/bin/bash
# taking backups
lcTypeBackup=$LC_TYPE
langTypeBackup=$LANG
export LC_TYPE=C
export LANG=C
# directory
currentDir=$PWD
@Tafhim
Tafhim / you-dont-know-js-ebooks.sh
Created December 27, 2018 22:54 — forked from bmaupin/epub.css
You Don't Know JS Ebooks
sudo apt install fonts-dejavu-core git pandoc
git clone https://github.com/getify/You-Dont-Know-JS.git
wget -O You-Dont-Know-JS/epub.css https://gist.githubusercontent.com/bmaupin/6e3649af73120fac2b6907169632be2c/raw/epub.css
cd You-Dont-Know-JS
# Clean up redundant headings that end up getting split into separate chapters by themselves
find . -iname "*.md" -exec sed -i '/# You Don'\''t Know JS.*/d' {} \;
# Fix <br> tags which pandoc won't convert to <br />
find . -iname "*.md" -exec sed -i 's#<br>#<br />#' {} \;
@Tafhim
Tafhim / bb-dwqa.js
Created October 12, 2017 13:15
Front end methods for the bbPress to DWQA conversion.
var author_list;
var author_index = 0;
var forum_index = 0;
var topic_index = 0;
var reply_index = 0;
var forum_list = [];
var topic_list = [];
var reply_list = [];
var json;
@Tafhim
Tafhim / mysql-issue
Created August 24, 2017 10:51
Fix mysql issue
http://blog.ijun.org/2011/02/mysqlinstalldb-fatal-error-could-not.html
Solution:
// look for binary path.
which mysql_install_db
/usr/local/bin/mysql_install_db
# BEGIN Cache-Control Headers
<ifModule mod_headers.c>
<filesMatch "\.(ico|jpe?g|png|gif|swf)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(css)$">
Header set Cache-Control "public"
</filesMatch>
<filesMatch "\.(js)$">
Header set Cache-Control "private"
@Tafhim
Tafhim / move.py
Last active July 9, 2021 20:48
Move dotfiles to backup directory
#!/usr/bin/python
import shutil
import time
import datetime
import os
import re
SRC_DIRECTORY_ROOT = '/fully/qualified/path/to/source'
DEST_DIRECTORY_ROOT = '/fully/qualified/path/to/destination'
@Tafhim
Tafhim / Setup.md
Created July 8, 2017 06:20 — forked from suvozy/Setup.md
Setup AWS EC2 and RDS (php5.5, apache2.4, mysql5.5, phpmyadmin)
@Tafhim
Tafhim / display_management
Last active November 27, 2016 16:42
You can link this to your /usr/local/bin and call it like "reset_display left", "reset_display right" or simply "reset_display"
#!/bin/bash
left_display="eDP1"
right_display="HDMI2"
if [ $1 = "left" ]
then
xrandr --output $left_display --mode 1366x768 --output $right_display --off
elif [ $1 = "right" ]
then