Skip to content

Instantly share code, notes, and snippets.

View davinkevin's full-sized avatar
👋
Working hard !

Davin Kevin davinkevin

👋
Working hard !
View GitHub Profile
.rating {
color: #a9a9a9;
margin: 0;
padding: 0;
}
ul.rating {
display: inline-block;
}
@davinkevin
davinkevin / restore.java
Created June 24, 2016 05:15
Method to restore database of H2 programmatically / in sql
@Transactional
public Boolean restore(String filename, TimeUnit timeUnit, Integer during) {
Path restoreFile = backup.getLocation().resolve(filename);
if (!Files.exists(restoreFile))
return Boolean.FALSE;
log.info("Full database reset");
em.createNativeQuery("DROP ALL OBJECTS;").executeUpdate();
javascript:(function () { if (!angular) { alert('Not a angular application or window.angular not found'); return; } var root = angular.element(document.getElementsByTagName('body')); var watchers = []; var f = function (element) { angular.forEach(['$scope', '$isolateScope'], function (scopeProperty) { if (element.data() && element.data().hasOwnProperty(scopeProperty)) { angular.forEach(element.data()[scopeProperty].$$watchers, function (watcher) { watchers.push(watcher); }); } }); angular.forEach(element.children(), function (childElement) { f(angular.element(childElement)); }); }; f(root); var watchersWithoutDuplicates = []; angular.forEach(watchers, function(item) { if(watchersWithoutDuplicates.indexOf(item) < 0) { watchersWithoutDuplicates.push(item); } }); alert('There is ' + watchersWithoutDuplicates.length + ' watcher
@davinkevin
davinkevin / How long is a digest cycle ?
Last active December 14, 2016 12:25
Count the number of watchers in AngularJS 1 include in bookmarklet
javascript:(function() {
if (!angular) {
alert('Not a angular application or window.angular not found');
return;
}
var entryNode = document.querySelector('[ng-app]') || document.querySelector('.ng-scope');
if (!entryNode) {
alert('No entryPoint found');
#!/bin/sh
### BEGIN INIT INFO
# Provides: regenerate_ssh_host_keys
# Required-Start:
# Required-Stop:
# Default-Start: 2
# Default-Stop:
# Short-Description: Regenerate ssh host keys
# Description:
### END INIT INFO
@davinkevin
davinkevin / viewControllersInConfig
Created May 15, 2015 22:47
SpringConfiguration to catch all not already defined route
@Configuration
@ComponentScan("lan.dk.podcastserver.controller")
public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/").setViewName("index.html"); // Same thing without this line
registry.addViewController("/**").setViewName("index.html");
super.addViewControllers(registry); // and this line...
}
@davinkevin
davinkevin / ffprobe.help.txt
Created July 25, 2016 02:37
ffprobe.help.txt
Simple multimedia streams analyzer
usage: ffprobe [OPTIONS] [INPUT_FILE]
Main options:
-L show license
-h topic show help
-? topic show help
-help topic show help
--help topic show help
-version show version

Keybase proof

I hereby claim:

  • I am davinkevin on github.
  • I am davinkevin (https://keybase.io/davinkevin) on keybase.
  • I have a public key whose fingerprint is 644E B07F A148 89FB 4770 1A70 7DEB EEB4 3ED5 B589

To claim this, I am signing this object:

@davinkevin
davinkevin / ng.fish
Created October 19, 2016 05:27
angular-cli autocomplete
# ng help
complete -f -c ng -n '__fish_use_subcommand' -a help -d 'Outputs the usage instructions for all commands or the provided command.'
# ng version
complete -f -c ng -n '__fish_use_subcommand' -a version -d 'Outputs angular-cli version.'
complete -f -A -c ng -n '__fish_seen_subcommand_from version' -l verbose -d 'verbose (Boolean) (Default: false)'
@davinkevin
davinkevin / s3.tf
Last active February 5, 2020 13:22
test terraform
# Test de comment !
# Sur plusieurs ligne 👍
resource "aws_s3_bucket" "my-bucket-example" {
bucket = "my-bucket-example-23413426676567"
acl = "public-read"
}
resource "aws_s3_bucket_object" "picture-of-cat" {
bucket = aws_s3_bucket.my-bucket-example.id