Skip to content

Instantly share code, notes, and snippets.

View youssefeldakar's full-sized avatar

Youssef Eldakar youssefeldakar

  • Bibliotheca Alexandrina
  • Alexandria, Egypt
View GitHub Profile
@youssefeldakar
youssefeldakar / sample.csv
Created August 31, 2022 11:56
Generate vCard contacts from CSV using a template
mobile name
+##########01 name1
+##########02 name2
@youssefeldakar
youssefeldakar / json-escape.py
Created June 13, 2020 13:15
Verify double-quote escaping in JSON
#!/usr/bin/python3
import sys
import json
# Try this ./json-escape.py '"abc"'
s = { "a": { "b": sys.argv[1] } }
print(json.dumps(s))
@youssefeldakar
youssefeldakar / get-d-i.sh
Created December 24, 2019 12:10
Get Debian (or Ubuntu) netboot installer files for multiple distributions
#!/bin/sh
#
# [email protected]
#
# get-d-i.sh ftp.debian.org/debian/{lenny,squeeze} archive.ubuntu.com/ubuntu/lucid
for i in $*; do
@youssefeldakar
youssefeldakar / db-access-example.py
Created September 12, 2019 09:35
Python: SQLAlchemy db access example
#!/usr/bin/python
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine
Base = automap_base()
engine = create_engine('mysql://rmanalyzer:42c718i1@localhost/redmine')
@youssefeldakar
youssefeldakar / Exec.java
Created September 9, 2019 09:05
Java: Execute process and prefix output lines with 'o' or 'e'
import java.lang.*;
import java.io.*;
public class Exec {
public static void main(String[] args) {
try {
Process process = Runtime.getRuntime().exec("ls /vmlinuz /mvlinuz");
try {
process.waitFor();
@youssefeldakar
youssefeldakar / sacctmins
Last active December 30, 2020 09:44
Print Slurm bank account usage/quota minutes for a given resource
#!/bin/sh
# This gist has moved under github.com/hpcalex/slurmies/ as of 2020-12-30.
# Usage: sacctmins <acct> <resc>
# Reference for Slurm commands:
#
# https://slurm.schedmd.com/sshare.html
@youssefeldakar
youssefeldakar / flexlm-intel.service
Last active June 13, 2019 09:03
FlexLM systemd integration
[Unit]
Description=Licence manger for Intel
After=network.target
[Service]
Type=simple
WorkingDirectory=/opt/flexlm/intel
ExecStart=/opt/flexlm/intel/lmgrd -z -c server.lic -log /var/opt/flexlm-intel/lmgrd.log
SuccessExitStatus=15
Restart=always
@youssefeldakar
youssefeldakar / CDXCollection.xml
Created May 29, 2019 15:49
OpenWayback CDXCollection with ZipNum
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"
default-init-method="init">
<bean id="localcdxcollection" class="org.archive.wayback.webapp.WaybackCollection">
<property name="resourceStore">
<bean class="org.archive.wayback.resourcestore.LocationDBResourceStore">
<property name="db" ref="resourcefilelocationdb" />