Skip to content

Instantly share code, notes, and snippets.

View Gregwar's full-sized avatar

Grégoire Passault Gregwar

View GitHub Profile
f:
pushl %ebp
movl %esp, %ebp
pushl %ebx
xorl %ebx, %ebx
subl $4, %esp
cmpl $9, 8(%ebp)
jle .L7
.p2align 4,,7
.p2align 3
@Gregwar
Gregwar / battery.sh
Last active December 21, 2015 14:28
Small script for getting battery state on the Debian image of the ICOO D50 lite low-cost tablet
#!/bin/bash
# Get the current status & voltage
STATUS=`cat /sys/class/power_supply/battery/status`
PERCENT=`cat /sys/class/power_supply/battery/capacity`
echo "$STATUS $PERCENT%"
@Gregwar
Gregwar / gist:6728800
Created September 27, 2013 13:44
def & extends
/**
* def & extends
*/
Object.prototype.def = function(variables) {
for (k in variables) {
this.prototype[k] = variables[k];
}
}
<?php
class A
{
public function __toString()
{
$x = new A;
htmlspecialchars($x);
}
};
<?php
class A {
private $x;
public function __sleep() {
return ['x'];
}
}
class B extends A {
@Gregwar
Gregwar / Program.cs
Last active September 5, 2017 15:14
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text;
class Program
{
public static void Main()
{
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text;
class Program
{
public static void Main()
{
@Gregwar
Gregwar / exemple.java
Created January 29, 2019 10:34
Exemple base de données PT2
static void listerLesFilms()
{
String requete = "SELECT nom, annee FROM movies";
try {
Statement stmt = connexion.createStatement();
ResultSet results = stmt.executeQuery(requete);
while (results.next()) {
System.out.println("* Film, nom: "+results.getString("nom")+", année: "+results.getString("annee"));
}
def f(x):
return 123
@Gregwar
Gregwar / ivp.py
Last active April 26, 2020 19:13
import matplotlib.pyplot as plt
import numpy as np
from scipy.integrate import solve_ivp
a, y0, g0 = 3, 100, 100
T = np.linspace(0, 30, 30)
gs = []
for t in T:
# G depends on Y