Skip to content

Instantly share code, notes, and snippets.

View Phyks's full-sized avatar

Lucas Verney Phyks

View GitHub Profile
@Phyks
Phyks / mirror_ftp.py
Last active April 26, 2022 14:30
Mirror a distant FTP using Python and lftp
#!/usr/bin/env python
"""
Simple Python wrapper around lftp to mirror a remote ftp onto a local folder.
New files are downloaded, deleted files are marked for removal in a TO_DELETE.sh
script.
"""
import os
import pprint
import re
{'author Barahona, F. title On the computational complexity of I sing spin glass models . journal Journal of Physics A: Mathematical and General volume 15 , pages 3241 ( year 1982 )': 'http://dx.doi.org/10.1088/0305-4470/15/10/028',
'author Bennett, C. , author Bernstein, E. , author Brassard, G. author Vazirani, U. title Strengths and weaknesses of quantum computing . journal SIAM Journal on Computing volume 26 , pages 1510-1523 ( year 1997 )': 'http://dx.doi.org/10.1137/s0097539796300933',
'author Berkley, A. J. et al. title A scalable readout system for a superconducting adiabatic quantum optimization system . journal Superconductor Science and Technology volume 23 , pages 105014 ( year 2010 )': 'http://dx.doi.org/10.1088/0953-2048/23/10/105014',
'author Berry, D. W. , author Childs, A. M. , author Cleve, R. , author Kothari, R. author Somma, R. D. title Exponential improvement in precision for simulating sparse hamiltonians . journal arXiv:1312.1414 ( year 2013 )': 'http://arxiv.org/abs/1312.1414',
'a
{'Abrikosov A. A., Gorʹkov L. P., Dzyaloshinski I. E. Dzi͡aloshinskiĭ I. E. Methods Of Quantum Field Theory In Statistical Physics (Dover Publications) 1975': None,
'Arnold P. Moore G. Phys. Rev. Lett. 87 2001 120401': None,
'Baym G., Blaizot J.-P., Holzmann M., Lalo e F. Vautherin D. Phys. Rev. Lett. 83 1999 1703': 'http://dx.doi.org/10.1103/physrevlett.83.1703',
"Capogrosso-Sansone B., Giorgini S., Pilati S., Pollet L., Prokof'ev N., Svistunov B. Troyer M. New Journal of Physics 12 2010 043010": 'http://dx.doi.org/10.1088/1367-2630/12/4/043010',
'Donnelly R. J. Phys. Today 62 2009 34–39': 'http://dx.doi.org/10.1063/1.3248499',
'Griffin A. Zaremba E. Phys. Rev. A 56 1997 4839': 'http://dx.doi.org/10.1103/physreva.56.4839',
'Hou Y.-H., Pitaevskii L. P. Stringari S. Phys. Rev. A 88 2013 043630': 'http://dx.doi.org/10.1103/physreva.88.043630',
'Hu H., Taylor E., Liu X.-J., Stringari S. Griffin A. New Journal of Physics 12 2010 043040': 'http://dx.doi.org/10.1088/1367-2630/12/4/043040',
"Kashurnikov V. A
{'author Barahona, F. title On the computational complexity of I sing spin glass models . journal Journal of Physics A: Mathematical and General volume 15 , pages 3241 ( year 1982 )': 'http://dx.doi.org/10.1088/0305-4470/15/10/028',
'author Bennett, C. , author Bernstein, E. , author Brassard, G. author Vazirani, U. title Strengths and weaknesses of quantum computing . journal SIAM Journal on Computing volume 26 , pages 1510-1523 ( year 1997 )': 'http://dx.doi.org/10.1137/s0097539796300933',
'author Berkley, A. J. et al. title A scalable readout system for a superconducting adiabatic quantum optimization system . journal Superconductor Science and Technology volume 23 , pages 105014 ( year 2010 )': 'http://dx.doi.org/10.1088/0953-2048/23/10/105014',
'author Berry, D. W. , author Childs, A. M. , author Cleve, R. , author Kothari, R. author Somma, R. D. title Exponential improvement in precision for simulating sparse hamiltonians . journal arXiv:1312.1414 ( year 2013 )': 'http://arxiv.org/abs/1312.1414',
'a
@Phyks
Phyks / workspace_back_and_forth_enhanced.py
Last active February 22, 2021 22:37
Enhanced back_and_forth for workspaces in i3.
#!/usr/bin/env python3
"""
Enhanced version of the workspace_back_and_forth of i3. Support a history of up
to 20 previously focused workspaces. See
https://www.reddit.com/r/i3wm/comments/40ncsn/window_back_and_forth_stack/
How to use:
* Put this file somewhere in your `$PATH`.
* In your `.i3/config` file, run the server on startup:
% rofi -dump-xresources
! Enabled modi
rofi.modi: window,run,ssh
! Window opacity
rofi.opacity: 100
! Window width
rofi.width: 50
! Number of lines
rofi.lines: 15
! Number of columns
@Phyks
Phyks / google_now.py
Last active May 7, 2019 21:02
Fetch Google "Now" answers from the CLI. Usage: `python3 google_now.py QUERY`.
#!/usr/bin/env python3
import sys
import urllib.parse
import html2text
import scrapy
from scrapy.crawler import CrawlerProcess
results = []
% php test.php
--- Original
+++ New
...
-define('NO_SESSION','1');
...
- $params['object_id'] = $_REQUEST['object_id'];
+ $params['object_id'] = $_REQUEST['object_id'] + 1;
...
<?php
$ampache_url = 'ampache.example.org:3689'; // EDIT ACCORDING TO YOUR NEEDS, DO NOT PUT ANY HTTP://
$request = $_SERVER['REQUEST_URI'];
$ch = curl_init();
// If there was a POST request, then forward that as well.
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
curl_setopt($ch, CURLOPT_POST, true);
@Phyks
Phyks / models.md
Created October 5, 2016 02:22
Models description for cozy

Models

The Cozy datastore stores documents, which can be seen as JSON objects. A doctype is simply a declaration of the fields in a given JSON object, to store similar objects in an homogeneous fashion.

Cozy ships a built-in list of doctypes for representation of most of the common documents (Bills, Contacts, Events, ...).

Whenever your app needs to use a given doctype, you should:

  • Check if this is a standard doctype defined in Cozy itself. If this is the case, you should add a model declaration in your app containing at least the fields listed in the main fields list for this doctype. Note that you can extend the Cozy-provided doctype with your own customs fields. This is typically what is done in Konnectors for the Bill doctype.
  • If no standards doctypes fit your needs, you